<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="/commons/pages/taglibs.jsp" %>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>栏目管理</title>
<link rel="stylesheet" type="text/css" href="../jquery-easyui/themes/${themes}/easyui.css">
<link rel="stylesheet" type="text/css" href="../jquery-easyui/themes/icon.css">
<link rel="stylesheet" type="text/css" href="../styles/demo.css">
<script type="text/javascript" src="../jquery-easyui/jquery.min.js"></script>
<script type="text/javascript" src="../jquery-easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="../jquery-easyui/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="../scripts/public.js.jsp"></script>
<script type="text/javascript" src="${ctx}/platform/type-info/format"></script>
</head>
<body>
<div class="demo-info" style="margin-bottom:5px;">
  <ul style="padding-left:10px;">
    <li>锁定的栏目不能逻辑删除，以保证目录结构的正确性</li>
    <li>公共的模块表示对所有用户可见（导航显示，链接），相当于一个Ｘ（执行权限）</li>
    <li>每个栏目都有默认允许可用来授权的操作，只能对这些操作进行授权</li>
  </ul>
</div>
<c:if test="${fn:containsIgnoreCase(action_codes, 'S')}">
  <div style="padding:5px; margin-bottom:5px; display:block;" class="combo">
    <form method="post" id="fm_search" novalidate>
      删除：
        <select id="is_del" name="is_del" style="width:50px;">
      </select>
      <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick="doSearch({grid:'treegrid'});">搜索</a> <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-reload'" onclick="$('#fm_search').form('clear');">重置</a>
    </form>
  </div>
</c:if>
<div id="dg"> </div>
<div id="dlg" class="easyui-dialog" data-options="closed:true, modal:true, buttons:'#dlg-buttons'" style="width:400px; height:420px; padding:10px 40px">
  <form method="post" id="fm" novalidate>
    <input name="id" type="hidden" id="id" />
    <table>
      <tr>
        <td align="right"><b>名称：</b></td>
        <td><input id="mod_name" name="mod_name" style="width:200px;" type="text" class="easyui-validatebox" data-options="required:true" /></td>
      </tr>
      <tr>
        <td align="right"><b>编码：</b></td>
        <td><input id="mod_code" name="mod_code" style="width:200px;" type="text" class="easyui-validatebox" data-options="required:true" /></td>
      </tr>
      <tr>
        <td align="right"><b>父编码：</b></td>
        <td><input id="mod_pcode" name="mod_pcode" style="width:200px;" type="text" class="easyui-validatebox" data-options="required:true" /></td>
      </tr>
      <tr>
        <td align="right"><b>URL：</b></td>
        <td><input id="mod_url" name="mod_url" style="width:200px;" type="text" class="easyui-validatebox" /></td>
      </tr>
      <tr>
        <td align="right"><b>图标：</b></td>
        <td><input id="mod_icon" name="mod_icon" style="width:200px;" type="text" class="easyui-validatebox" /></td>
      </tr>
      <tr>
        <td align="right"><b>说明：</b></td>
        <td><input id="mod_desc" name="mod_desc" style="width:200px;" type="text" /></td>
      </tr>
      <tr>
        <td align="right" title="公共节点对任何人可见，无需授权"><b>是否公共：</b></td>
        <td><select id="is_public" name="is_public" style="width:80px;" class="easyui-validatebox" data-options="required:true">
          </select></td>
      </tr>
      <tr>
        <td align="right"><b>可授权的动作：</b></td>
        <td><input id="action_codes" name="action_codes" style="width:200px;" type="text" /></td>
      </tr>
      <tr>
        <td align="right"><b>排序值：</b></td>
        <td><input id="order_value" name="order_value" style="width:80px;" class="easyui-numberspinner" min="0" max="9999" value="0" /></td>
      </tr>
      <tr>
        <td align="right"><b>锁定：</b></td>
        <td><select id="is_lock" name="is_lock" style="width:80px;" class="easyui-validatebox" data-options="required:true">
          </select></td>
      </tr>
      <tr>
        <td align="right"><b>删除：</b></td>
        <td><select id="is_del" name="is_del" style="width:80px;" class="easyui-validatebox" data-options="required:true">
          </select></td>
      </tr>
    </table>
  </form>
</div>
<div id="dlg-buttons"> <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-save'" onclick="doSave({grid:'treegrid'});">保存</a> <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" onclick="$('#dlg').dialog('close');">关闭</a> </div>
<script type="text/javascript">
$(function(){
	//初始化列表
	var cfg = {'grid':'treegrid'};
	$('#dg').treegrid({  
	    url:'${ctx}/platform/sys-module/search',
		queryParams:$('#fm_search').serializeObject(),
	    idField:'id',  
	    treeField:'mod_name',
	    //animate:true,
	    onBeforeCollapse:function(){
	    	$.messager.alert(MSG_INFO, '展开/隐藏的功能本系统已屏蔽（太慢，影响心情）！请勿再试。', 'info');
	    	return false;
	    },
	    frozenColumns:[[
	    	{field:'ck',checkbox:true}
	 	]],
	    columns:[[
			{field:'id',title:'id',hidden:true},
			{field:'mod_icon',title:'图标'/*,width:40*/,align:'center',formatter:formatActionIcon},
			{field:'mod_name',title:'名称',width:200},
	        {field:'mod_code',title:'编码'/*,width:50*/,align:'right'},
	        {field:'mod_pcode',title:'父编码'/*,width:50*/,align:'right'},
	        {field:'mod_url',title:'URL'/*,width:120*/},
			{field:'mod_desc',title:'说明'/*,width:100*/},
			//{field:'mod_level',title:'级别'/*,width:40*/,align:'center'},
			//{field:'is_leaf',title:'叶子节点'/*,width:40*/,align:'center',formatter:formatBoolean,styler:styleBoolean},
			{field:'is_public',title:'是否公共'/*,width:40*/,align:'center',formatter:formatBoolean,styler:styleBoolean},
			{field:'action_codes',title:'可授权的操作'/*,width:100*/},
			{field:'order_value',title:'排序值'/*,width:50*/,align:'right'},
			{field:'is_lock',title:'锁定'/*,width:40*/,align:'center',formatter:formatBoolean,styler:styleBoolean},
			{field:'is_del',title:'删除'/*,width:40*/,align:'center',formatter:formatBoolean,styler:styleBoolean}
	    ]],
		//pageSize:20,
		//pageList:[10,20,30,40,50,100],
		//fitColumns:true,
		striped:true,
		remoteSort:false,
		rownumbers:true,
		singleSelect:false,
		toolbar:[
			//<c:if test="${fn:containsIgnoreCase(action_codes, 'D')}">
			{
				id:'btnRemove',
				text:'删除',
				iconCls:'icon-remove',
				handler:function(){doRemove(cfg);}
			},'-',
			//</c:if>
			//<c:if test="${fn:containsIgnoreCase(action_codes, 'C')}">
			{
				id:'btnAdd',
				text:'添加',
				iconCls:'icon-add',
				handler:function(){doAdd(cfg);}
			},
			//</c:if>
			//<c:if test="${fn:containsIgnoreCase(action_codes, 'U')}">
			{
				id:'btnEdit',
				text:'修改',
				iconCls:'icon-edit',
				handler:function(){doEdit(cfg);}
			},
			//</c:if>{}
		] 
	});

});
</script>
</body>
</html>